def isAnagram(str1, str2): # DO NOT modify this line 
    list1=[]
    list2=[]
    for i in str1:
        list1.append(i)
    for j in str2:
        list2.append(j)
    list1.sort()
    list2.sort()
    if list1==list2:
        return True
    else:
        return False
 # You can modify or delete this line
# === DO NOT modify the code below ===
def main():
    s1 = input()
    s2 = input()
    print(1 if isAnagram(s1, s2) else 0)
    
if __name__ == '__main__':
    main()